package com.acme.service.bank;

import java.io.FileNotFoundException;
import java.io.PrintWriter;

import com.acme.domain.bank.Bank;
import com.acme.exceptions.ClientCountLimitException;

class BankDataSaverService {
	static void save(Bank bank,String path) throws FileNotFoundException{		
		PrintWriter out = new PrintWriter(path);
		for (int i=1;i<=bank.getNumberOfClients();i++){
			try {
				out.println(bank.getClient(i).printSerial());
			} catch (ClientCountLimitException e) {
				e.printStackTrace();
			}
		}
		out.close();
	}
}
